Telegram Group & Telegram Channel
3. Determining variable type with type()

>> a=7
>>> type(a)
<class 'int'>

>>> b=7.7
>>> type(b)
<class 'float'>

>>> c="hello"
>>> type(c)
<class 'str'>

>>> d=[1,2,3]
>>> type(d)
<class 'list'>

>>> e=(1,2,3)
>>> type(e)
<class 'tuple'>

>>> f={1:"one",2:"two"}
>>> type(f)
<class 'dict'>

>>> g={1,2,3}
>>> type(g)
<class 'set'>

>>> i=True
>>> type(i)
<class 'bool'>





You can check what type of object is assigned to a variable using Python's built-in type() function. Common data types include:

int (for integer)
float
str (for string)
list
tuple
dict (for dictionary)
set
bool (for Boolean True/False)

@python_codes



tg-me.com/python_codes/6
Create:
Last Update:

3. Determining variable type with type()

>> a=7
>>> type(a)
<class 'int'>

>>> b=7.7
>>> type(b)
<class 'float'>

>>> c="hello"
>>> type(c)
<class 'str'>

>>> d=[1,2,3]
>>> type(d)
<class 'list'>

>>> e=(1,2,3)
>>> type(e)
<class 'tuple'>

>>> f={1:"one",2:"two"}
>>> type(f)
<class 'dict'>

>>> g={1,2,3}
>>> type(g)
<class 'set'>

>>> i=True
>>> type(i)
<class 'bool'>





You can check what type of object is assigned to a variable using Python's built-in type() function. Common data types include:

int (for integer)
float
str (for string)
list
tuple
dict (for dictionary)
set
bool (for Boolean True/False)

@python_codes

BY Python Codes


Warning: Undefined variable $i in /var/www/tg-me/post.php on line 283

Share with your friend now:
tg-me.com/python_codes/6

View MORE
Open in Telegram


Python Codes Telegram | DID YOU KNOW?

Date: |

The Singapore stock market has alternated between positive and negative finishes through the last five trading days since the end of the two-day winning streak in which it had added more than a dozen points or 0.4 percent. The Straits Times Index now sits just above the 3,060-point plateau and it's likely to see a narrow trading range on Monday.

Importantly, that investor viewpoint is not new. It cycles in when conditions are right (and vice versa). It also brings the ineffective warnings of an overpriced market with it.Looking toward a good 2022 stock market, there is no apparent reason to expect these issues to change.

Python Codes from us


Telegram Python Codes
FROM USA